Custom Printer Library  1.17
ccw_Status.h
Go to the documentation of this file.
1 
2 // File Revision
3 // Rev 1.00
4 //
5 // - rel 1.00: first release
6 
7 // NOTE: Please DO NOT EDIT THIS FILE
8 
13 
14 
15 #ifndef _CCW_STATUS_H__
16 #define _CCW_STATUS_H__
17 
18 #include "ccw_Types.h"
19 #include "WinTypes.h"
20 #include <wchar.h>
21 
22 #pragma pack(1)
23 
24 
28 typedef struct {
29 
30  //**************************************
31  //Status Vars: BYTE 1
32  //**************************************
33 
38  BOOL stsNOPAPER;
49 
50  //**************************************
51  //Status Vars: BYTE 2
52  //**************************************
53 
58  BOOL stsNOHEAD;
63  BOOL stsNOCOVER;
84 
85  //**************************************
86  //Status Vars: BYTE 3
87  //**************************************
88 
98  BOOL stsHLVOLT;
104 
105  //**************************************
106  //Status Vars: BYTE 4
107  //**************************************
108 
124 
126  BYTE reserved[1024];
128 
129 
140 static void PrinterStatusStructToText(PrinterStatusStruct* pStatus, wchar_t* szBufferOut, DWORD dwBuffCharSize)
141 {
142  if (pStatus == NULL || szBufferOut == NULL)
143  {
144  return;
145  }
146 
147  wchar_t* szApp = new wchar_t[MAXCHARBUFFER];
148  wmemset(szApp, 0, MAXCHARBUFFER);
149 
150  // Create string
151  wcscpy(szBufferOut, L"Printer status: ");
152 
153  // Add all status
154  //
155 
156  //**************************************
157  //Status Vars: BYTE 1
158  //**************************************
159  if (pStatus->stsNOPAPER)
160  {
161  swprintf(szApp, MAXCHARBUFFER, L"NO PAPER; ");
162  wcsncat(szBufferOut, szApp, (dwBuffCharSize - wcsnlen(szBufferOut, dwBuffCharSize) + 1));
163  }
164  if (pStatus->stsNEARENDPAP)
165  {
166  swprintf(szApp, MAXCHARBUFFER, L"NEAR PAPER END; ");
167  wcsncat(szBufferOut, szApp, (dwBuffCharSize - wcsnlen(szBufferOut, dwBuffCharSize) + 1));
168  }
169  if (pStatus->stsTICKETOUT)
170  {
171  swprintf(szApp, MAXCHARBUFFER, L"TICKET OUT; ");
172  wcsncat(szBufferOut, szApp, (dwBuffCharSize - wcsnlen(szBufferOut, dwBuffCharSize) + 1));
173  }
174 
175  //**************************************
176  //Status Vars: BYTE 2
177  //**************************************
178  if (pStatus->stsNOHEAD)
179  {
180  swprintf(szApp, MAXCHARBUFFER, L"HEAD UP; ");
181  wcsncat(szBufferOut, szApp, (dwBuffCharSize - wcsnlen(szBufferOut, dwBuffCharSize) + 1));
182  }
183  if (pStatus->stsNOCOVER)
184  {
185  swprintf(szApp, MAXCHARBUFFER, L"COVER OPEN; ");
186  wcsncat(szBufferOut, szApp, (dwBuffCharSize - wcsnlen(szBufferOut, dwBuffCharSize) + 1));
187  }
188  if (pStatus->stsSPOOLING)
189  {
190  swprintf(szApp, MAXCHARBUFFER, L"SPOOLING; ");
191  wcsncat(szBufferOut, szApp, (dwBuffCharSize - wcsnlen(szBufferOut, dwBuffCharSize) + 1));
192  }
193  if (pStatus->stsPAPERROLLING)
194  {
195  swprintf(szApp, MAXCHARBUFFER, L"PAPER ROLLING; ");
196  wcsncat(szBufferOut, szApp, (dwBuffCharSize - wcsnlen(szBufferOut, dwBuffCharSize) + 1));
197  }
198  if (pStatus->stsLFPRESSED)
199  {
200  swprintf(szApp, MAXCHARBUFFER, L"LF PRESSED; ");
201  wcsncat(szBufferOut, szApp, (dwBuffCharSize - wcsnlen(szBufferOut, dwBuffCharSize) + 1));
202  }
203  if (pStatus->stsFFPRESSED)
204  {
205  swprintf(szApp, MAXCHARBUFFER, L"FF PRESSED; ");
206  wcsncat(szBufferOut, szApp, (dwBuffCharSize - wcsnlen(szBufferOut, dwBuffCharSize) + 1));
207  }
208 
209  //**************************************
210  //Status Vars: BYTE 3
211  //**************************************
212  if (pStatus->stsOVERTEMP)
213  {
214  swprintf(szApp, MAXCHARBUFFER, L"OVER TEMPERATURE; ");
215  wcsncat(szBufferOut, szApp, (dwBuffCharSize - wcsnlen(szBufferOut, dwBuffCharSize) + 1));
216  }
217  if (pStatus->stsHLVOLT)
218  {
219  swprintf(szApp, MAXCHARBUFFER, L"OVER VOLTAGE; ");
220  wcsncat(szBufferOut, szApp, (dwBuffCharSize - wcsnlen(szBufferOut, dwBuffCharSize) + 1));
221  }
222  if (pStatus->stsPAPERJAM)
223  {
224  swprintf(szApp, MAXCHARBUFFER, L"PAPER JAM; ");
225  wcsncat(szBufferOut, szApp, (dwBuffCharSize - wcsnlen(szBufferOut, dwBuffCharSize) + 1));
226  }
227 
228  //**************************************
229  //Status Vars: BYTE 4
230  //**************************************
231  if (pStatus->stsCUTERROR)
232  {
233  swprintf(szApp, MAXCHARBUFFER, L"CUTTER ERROR; ");
234  wcsncat(szBufferOut, szApp, (dwBuffCharSize - wcsnlen(szBufferOut, dwBuffCharSize) + 1));
235  }
236  if (pStatus->stsRAMERROR)
237  {
238  swprintf(szApp, MAXCHARBUFFER, L"RAM ERROR; ");
239  wcsncat(szBufferOut, szApp, (dwBuffCharSize - wcsnlen(szBufferOut, dwBuffCharSize) + 1));
240  }
241  if (pStatus->stsEEPROMERROR)
242  {
243  swprintf(szApp, MAXCHARBUFFER, L"EEPROM ERROR; ");
244  wcsncat(szBufferOut, szApp, (dwBuffCharSize - wcsnlen(szBufferOut, dwBuffCharSize) + 1));
245  }
246 
247 
248  // If not status is segnaled
249  if (szApp[0] == '\0')
250  {// Nothing segnaled
251  swprintf(szApp, MAXCHARBUFFER, L"Nothing to report.");
252  wcsncat(szBufferOut, szApp, (dwBuffCharSize - wcsnlen(szBufferOut, dwBuffCharSize) + 1));
253  }
254 
255  delete[] szApp;
256 }
257 
258 #pragma pack()
259 
260 #endif
261 
262 
263 
BOOL stsNEARENDPAP
Definition: ccw_Status.h:43
BOOL stsPAPERROLLING
Definition: ccw_Status.h:73
BOOL stsPAPERJAM
Definition: ccw_Status.h:103
BOOL stsSPOOLING
Definition: ccw_Status.h:68
BOOL stsCUTERROR
Definition: ccw_Status.h:113
BOOL stsRAMERROR
Definition: ccw_Status.h:118
BOOL stsNOCOVER
Definition: ccw_Status.h:63
BOOL stsFFPRESSED
Definition: ccw_Status.h:83
BOOL stsTICKETOUT
Definition: ccw_Status.h:48
BOOL stsHLVOLT
Definition: ccw_Status.h:98
Data and parameters definition.
Definition: ccw_Status.h:28
static void PrinterStatusStructToText(PrinterStatusStruct *pStatus, wchar_t *szBufferOut, DWORD dwBuffCharSize)
Definition: ccw_Status.h:140
#define MAXCHARBUFFER
Lenght, in characters, of a standard string.
Definition: ccw_Types.h:32
BOOL stsOVERTEMP
Definition: ccw_Status.h:93
BOOL stsEEPROMERROR
Definition: ccw_Status.h:123
BOOL stsNOHEAD
Definition: ccw_Status.h:58
BOOL stsLFPRESSED
Definition: ccw_Status.h:78
BOOL stsNOPAPER
Definition: ccw_Status.h:38